/* MALLOC.C
 * Custom malloc routines. Didn't work properly, so not used
 *************
 * 29.08.2000 : Toni R„s„nen
 *              modifications/documentation for open source
 *
 */

// thinking of memalloc routines...
// needs much work

#include <stdlib.h>
#include <stdio.h>

#define MAX_MEM_BLOCKS 256

char *mallocdata;
int mallocsize;

int blockoffs[MAX_MEM_BLOCKS];
int blocksize[MAX_MEM_BLOCKS];

int alloc_memory (int size)
{  int i;
   mallocsize=size;
   mallocdata = (char*) malloc (size);
   if (mallocdata == NULL) return 1;

   for (i = 0; i < MAX_MEM_BLOCKS; i++)
     blockoffs[i] = blocksize[i] = -1; // not allocated
   
   return 0;
}

int free_memory()
{  free (mallocdata);
   return 0;
}

// find free memory block
void find_free_block (size)
{
}

void* malloc2 (int size)
{  int o;
   o = find_free_block (size);
   return NULL;
}

int main()
{  if (alloc_memory(128000))
     {  printf ("out of memory.\n"); exit(0); }

   free_memory();
}
